home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 6 / MacMania 6.toast / / Tools&Utilities / Akua Sweet (osaxen) / Akua Sweet 101 Read'em (TexEd) < prev   
Text File  |  1997-06-10  |  5KB  |  80 lines

  1. AKUA Sweet V1.01
  2. ©1997 AKUA interactive media AG. All rights reserved. This suite is freeware unless used commercially in which case a $100 site and/or product license must be purchased. Contact godot@astarte.de for questions or licensing information.
  3.  
  4. Changes to V1.0
  5. --------------------
  6. •    Forgot to include the example scripts with the V1.0 release. Duh.
  7. •    Fixed a minor bug to AkuaCopy that would cause copies to occasionally fail.
  8. •    Added a “Resume” parameter to “AkuaCopy” to resume a copy operation where it broke.
  9. •    AkuaCopy can now be canceled by holding the Apple-Option keys down.
  10.  
  11.  
  12. ResolveWith
  13. ResolveTo
  14.  
  15. ◊ Description
  16. Both functions resolve an alias file with the ability to enter the User/Password in a possible resulting server dialog.
  17.  
  18. Both take a “User” and a “Password” parameter. The only difference is ResolveWith will only resolve one level deep and return an error code. This may be useful if your only goal is to mount a remote volume to which the alias points.
  19.  
  20. ResolveTo will further resolve any aliases pointed to by the alias. In addition it will return the resultant file. This is useful if you need to use the file you are resolving.
  21.  
  22. Both functions can take “” as a “User” parameter to indicate a guest logon.
  23.  
  24. ◊Technical
  25. Both functions work by temporarily patching “Modal Dialog” and auto-answering the dialog with the parameters you give it. If no dialog appears (i.e. the volume is mounted or the volume is local or the volume can not be accessed) then no actions are taken. If the file is not an alias file, ResolveAliasFile() returns the original file, so it is possible to run ResolveTo() on each and every file going through your open loop in order to support alias resolution in a script.
  26.  
  27.  
  28. AkuaCopy
  29.  
  30. ◊Description
  31. AkuaCopy results out of my big problems getting the Finder to copy some damn files without getting “Not a reference” or “Not the right type” or some other bullshit error. What a pain. copyFile from Jon’s Commands is cute, but it is neither RamDoubler friendly nor is it a very good interface to not show any status while copying 200MB over a network.
  32.  
  33. AkuaCopy supports the following features:
  34.     • The copy operation accelerates and/or decelerates as necessary (useful for ARA connections) to attempt to give the system time about 5 times per second.
  35.     • The copy operation shows a status (albeit a very ugly one) about what it is doing.
  36.     • The parameters are very simple. Two aliases, a source and a destination. The name of the file stays the same. And to really complicate matters, you can specify whether or not AkuaCopy should overwrite an existing destination file with the same name.
  37.     • You can even click somewhere outside the status window to switch applications and let the copy progress in the background.
  38.     • AkuaCopy supports the ability to resume a copy. This is useful for a copy that is broken by a network interruption.
  39.  
  40. ••• Don’t beat me on the head about the progress window. It was a quick API conversion from our normal status routines which do look good but don’t port well into an ‘osax’.
  41.  
  42. ••• NOTE: AkuaCopy does not know if it is in the foreground or background, so Apple-Option will break the copy regardless of where you are.
  43.  
  44.  
  45. Resolve
  46. Resolve&Copy
  47. Two scripts I wrote to demonstrate the use of these osaxen. Resolve just resolves any aliases in its own folder. Resolve&Copy resolves any aliases in a “Copy” folder within its own folder and copies them to its own folder. Both scripts must be modified before use, using your own logon name & password. Both folders need your aliases. I don’t think our HDs will mount from wherever you are:)
  48.  
  49. Both scripts will not run correctly from “Script Editor”, since they use “path to me” which in Script Editor returns a path to “Script Editor” (oh, that’s useful - not). Get Script Debugger or some other tool if you want to run them with a log...
  50.  
  51.  
  52. Have fun. I hope I’ve saved some of you a pain in the butt trying to get AppleScript to logon to a remote server and copy some files now that PowerTalk and KeyChains are gone. Soon I will upgrade the resolve functions to support general answers to coming dialogs (e.g. Linking to programs). E-mail <mailto:godot@astarte.de> if you are interested in updates.
  53.  
  54. Cheers,
  55. Gregory Lemperle-Kerr
  56. AKUA interactive media AG
  57. Zurich, 1997
  58.  
  59.  
  60. Programmers Hint: I got caught up for an hour on ResolveTo because the result occasionally was invalid (illegal parameter or some such nonsense popped up). Oddly this only occured for files whose originals were located in the root directory of some volume. The bug was in my forgetting to lock the alias before AEPutParamPtr. The error message was not very helpful :).
  61.  
  62. yError oxReturnAlias(AppleEvent * reply, fileSpec spec)
  63.  {
  64.     AliasHandle        ali;
  65.     yError            err;
  66.  
  67.  
  68.     if (!(err = NewAlias(NULL, spec, &ali)))
  69.      {
  70.         mmHdlLock(ali);
  71.  
  72.         err = AEPutParamPtr(    reply,
  73.                         keyDirectObject, typeAlias, 
  74.                         *(Handle)ali, mmHdlSizeGet(ali)    );
  75.         mmHdlDel(ali);
  76.      }
  77.  
  78.     return(err);
  79.  }
  80.